PHP_REQUIRE_CXX()
CXXFLAGS="$CXXFLAGS -Wall -std=c++11 -Wunused-variable"

PHP_ARG_ENABLE(monitorpro, whether to enable monitorpro support,
[  --enable-monitorpro           Enable monitorpro support])

if test "$PHP_MONITORPRO" != "no"; then
  AC_DEFINE(HAVE_MONITORPROLIB, 1, [ Have monitorpro support ])
  
  PHP_SUBST(MONITORPRO_SHARED_LIBADD)
  PHP_ADD_LIBRARY(stdc++, 1, MONITORPRO_SHARED_LIBADD)

  PHP_ADD_INCLUDE(src)

  PHP_NEW_EXTENSION(monitorpro, \
      monitorpro.cc \
      src/helper.cc \
      src/init.cc \
      src/execute.cc \
      src/agent.cc \
      src/base64.cc \
      src/cross_process_bag.cc \
      src/segment.cc \
      src/segment_reference.cc \
      src/span.cc \
      src/tag.cc \
      src/shm.cc \
      src/scaler.cc \
      src/tcp_client.cc \
      src/pushgateway_client.cc \
      src/m_predis.cc \
      src/m_phpredis.cc \
      src/m_pdo.cc \
      src/m_mysqli.cc \
      src/m_curl.cc \
  , $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi
